<template>
  <div id="main">
    <div class="top-box">
      <img @touchstart="goback" class="left-arrow" src="@/assets/书城/shape_u112.png" alt />
      <span :class="{greenfont:create==1}" @touchstart="gomycreate">我创建的</span>
      <span :class="{greenfont:collect==2}" @touchstart="gomycollect">我收藏的</span>
      <div></div>
    </div>
    <div class="midbox">
      <router-view></router-view>
      <div @touchstart="gocreatelist" class="addbooklist">
        <img src="@/assets/书架/u4297.png" alt />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      create: 1,
      collect: 1
    };
  },
  methods: {
    goback() {
      this.$router.go(-1);
    },
    gomycreate() {
      this.$router.push(
        {
          path: "/createlist"
        },
        () => {}
      );
      (this.create = 1), (this.collect = 1);
    },
    gomycollect() {
      this.$router.push(
        {
          path: "/collectlist"
        },
        () => {}
      );
      (this.create = 2), (this.collect = 2);
    },
    gocreatelist(){
        this.$router.push({
            path:'/createmylist'
        },()=>{})
    }
  }
};
</script>

<style lang="less" scoped>
#main {
  width: 100%;
  .top-box {
    box-sizing: border-box;
    width: 100%;
    height: 1.6rem;
    display: flex;
    justify-content: space-between;
    background-color: rgba(255, 255, 255, 1);
    padding: 0 1.5rem;
    padding-top: 1.5rem;
    padding-bottom: 2.5rem;
    height: 5rem;
    position: fixed;
    top: 0;
    left: 0;
    border-bottom: .1rem solid #f2f2f2;
    img {
      margin-top: .5rem;
    }
    .left-arrow {
      width: .9rem;
      height: 1.4rem;
    }
    span {
      font-family: "PingFangSC-Regular", "PingFang SC";
      font-weight: 400;
      font-style: normal;
      font-size: 1.6rem;
      color: #999999;
      text-align: center;
      height: 2.3rem;
      position: relative;
    }
    .greenfont {
      font-weight: bold;
      color: rgb(40, 208, 148);
      &::after {
        content: "";
        width: 2.7rem;
        height: .6rem;
        background-color: rgb(40, 208, 148);
        position: absolute;
        border-radius: .5rem;
        top: 122%;
        left: 50%;
        transform: translateX(-50%);
      }
    }
  }
  .midbox {
    box-sizing: border-box;
    width: 100%;
    padding: 0 1.5rem;
    height: 100%;
    margin-top: 5rem;
    .addbooklist {
      width: 4.8rem;
      height: 4.8rem;
      border-radius: 50%;
      background: inherit;
      background-color: rgba(40, 208, 148, 1);
      box-shadow: 0rem .4rem 1.8rem rgb(40 208 148 / 36%);
      position: fixed;
      bottom: 2.5rem;
      right: 1.5rem;
      img{
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%,-50%);
      }
    }
  }
}
</style>